/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package pt.our.angemc.modifications;

import java.util.HashMap;
import pt.our.angemc.datatypes.Grammar;

/**
 *
 * @author piskeiro
 */
public abstract class GrammarModification extends Grammar{
    private boolean performedModification         = false;
    private boolean calculatedModificationMetrics = false;
    private boolean predictedModificationMetrics  = false;

    /**Grammar grammar should be cloned if you don't want to modified the original grammar
     *                 shouldn't be cloned otherwise
     */
    public GrammarModification(Grammar grammar){
        super(grammar);
    }

    public void setPerformedModification(boolean performedModification) {
        this.performedModification = performedModification;
    }

    public boolean performedModification() {
        return performedModification;
    }

    public void setCalculatedModificationMetrics(boolean calculatedModificationMetrics) {
        this.calculatedModificationMetrics = calculatedModificationMetrics;
    }

    public boolean calculatedModificationMetrics() {
        return calculatedModificationMetrics;
    }

    public void setPredictedModificationMetrics(boolean predictedModificationMetrics) {
        this.predictedModificationMetrics = predictedModificationMetrics;
    }

    public boolean predictedModificationMetrics() {
        return predictedModificationMetrics;
    }

    /**
     * performModification skeleton
     *  public void performModification() {
     *      if(!this.performedModification()){
     *          //perform modifications
     *          this.setPerformedModification(true);
     *          calculateModificationMetrics();
     *      }
     *  }
     */
    public abstract void performModification();

    /**
     * predictModificationMetrics skeleton
     *  public HashMap<String,Object> predictModificationMetrics() {
     *      if(!predictedModificationMetrics() && !calculatedModificationMetrics()){
     *          //predict
     *          setPredictedModificationMetrics(true);
     *      }
     *      return this.getMetrics();
     *  }
     *
     * @return the metrics that were calculate now, or before(lazzy calculation/return)
     */
    public abstract HashMap<String,Object> predictModificationMetrics();

    /**
     * calculateModificationMetrics skeleton
     *  public HashMap<String,Object> calculateModificationMetrics() {
     *      if(!calculatedModificationMetrics()){
     *          //calculate
     *          setCalculatedModificationMetrics(true);
     *      }
     *      return this.getMetrics();
     *  }
     *
     * @return the metrics that were calculate now, or before(lazzy calculation/return)
     */
    public abstract HashMap<String,Object> calculateModificationMetrics();
}
